<%@ page language="java" pageEncoding="UTF-8" contentType="text/html; charset=utf-8" errorPage="/error.jsp" isELIgnored="false" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-tiles" prefix="tiles" %>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://www.opensymphony.com/oscache" prefix="cache" %>
<%@ taglib uri="http://atleap.blandware.com/taglib" prefix="atleap" %>
<html:xhtml />

<atleap:constants className="com.blandware.atleap.webapp.taglib.core.grid.util.FilterConditions" scope="page" />
<atleap:constants className="com.blandware.atleap.webapp.taglib.core.grid.util.SetFilter" scope="page" />
<atleap:form action="/grid/setFilter.do" method="POST" validateOnSubmit="false">
	<table cellpadding="0" cellspacing="0" border="0"  width="490" class="filter-table">
		<tr>
			<td colspan="3" align="right" class="filter-errorMessage" width="25%"><atleap:messages property="firstValue" /></td>
		</tr>
		<tr>
			<td width="110" class="filter-FildName">
				<c:choose>
					<c:when test="${setFilterForm.fieldKey != null}">
						<atleap:message key="${setFilterForm.fieldKey}" />
					</c:when>
					<c:otherwise>
						<c:out value="${setFilterForm.fieldName}" escapeXml="true" />
					</c:otherwise>
				</c:choose>
			</td>
			<td class="filter-condition">
				<html:select property="firstCondition">
					<html:option key="core.grid.filter.isNull" value="${pageScope.OBJECT_IS_NULL}" />
					<html:option key="core.grid.filter.isNotNull" value="${pageScope.OBJECT_IS_NOT_NULL}" />
					<html:option key="core.grid.filter.set.inSet" value="${pageScope.FIELD_IN_SET}" />
					<html:option key="core.grid.filter.set.notInSet" value="${pageScope.FIELD_NOT_IN_SET}" />
				</html:select>
			</td>
			<td class="setFilterButton">
				<atleap:submit styleClass="button" onclick="if ( window.opener == null ) { window.close(); return false; } bCancel=false;" style="width: 120px;"><atleap:message key="core.grid.filter.submit" /></atleap:submit>
			</td>
		</tr>
		<tr>
			<td></td>
			<td>
				<logic:iterate id="elem" collection="${sessionScope[pageScope.AVAILABLE_ELEMENTS]}">
				    <div>
                        <c:set var="escapedKey"><c:out value="${elem.key}" escapeXml="true" /></c:set>
				        <html:checkbox property="element(${escapedKey})">
                        	<c:out value="${elem.value}" escapeXml="true" />
					    </html:checkbox>
				    </div>
				</logic:iterate>
			</td>
			<td valign="top">
				<table class="noBorder" cellpadding="0" cellspacing="0" border="0" width="200">
					<tr>
						<td class="setFilterButton">
							<atleap:cancel property="clearFilter" styleClass="button" style="width: 120px;"><atleap:message key="core.grid.filter.clear" /></atleap:cancel>
						</td>
					</tr>
					<tr>
						<td class="setFilterButton">
							<atleap:cancel styleClass="button" onclick="if ( window.opener != null ) { window.opener.focus(); } window.close(); return false;" style="width: 120px;"><atleap:message key="core.grid.filter.cancel" /></atleap:cancel>
						</td>
					</tr>
				</table>
			</td>
	   </tr>
	</table>
	<html:hidden property="fieldName" />
	<html:hidden property="gridName" />
	<html:hidden property="pageUrl" />
	<html:hidden property="fieldKey" />
	<html:hidden property="rowIterators" />
</atleap:form>
